package com.safe.ocs.controls;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.safe.ocs.beans.OMsgPageBean;
import com.safe.ocs.utils.HibernateUtil;

public class DeleteAction extends DispatchAction 
{
	public ActionForward deleteAll(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws Exception
			{
				response.setContentType("text/html;charset=utf-8");
				PrintWriter out = response.getWriter();
				String sql = "delete from Outputsms"; 
				Session session = HibernateUtil.getSession();
				Transaction transaction=session.beginTransaction(); 
				session.createSQLQuery(sql).executeUpdate();
				
				//session.delete(sql); 
				transaction.commit(); 
				out.write("{success:chenggong}");
				return null;
			}
}